home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / gfx / show / swfplayersrc.lha / Lib / font.cc < prev    next >
C/C++ Source or Header  |  1999-09-01  |  2KB  |  106 lines

  1. /////////////////////////////////////////////////////////////
  2. // Flash Plugin and Player
  3. // Copyright (C) 1998 Olivier Debon
  4. // 
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the GNU General Public License
  7. // as published by the Free Software Foundation; either version 2
  8. // of the License, or (at your option) any later version.
  9. // 
  10. // This program is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. // GNU General Public License for more details.
  14. // 
  15. // You should have received a copy of the GNU General Public License
  16. // along with this program; if not, write to the Free Software
  17. // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  18. // 
  19. ///////////////////////////////////////////////////////////////
  20. //  Author : Olivier Debon  <odebon@club-internet.fr>
  21. //  
  22.  
  23. #include "swf.h"
  24.  
  25. #ifdef RCSID
  26. static char *rcsid = "$Id: font.cc,v 1.6 1999/02/14 22:03:31 olivier Exp $";
  27. #endif
  28.  
  29. SwfFont::SwfFont(long id) : Character(FontType, id)
  30. {
  31.     glyphs = 0;
  32.     nbGlyphs = 0;
  33.         name = NULL;
  34.     setFontName("Unknown");
  35.     flags = (FontFlags)0;
  36.     lookUpTable = 0;
  37. }
  38.  
  39. SwfFont::~SwfFont()
  40. {
  41.     if (lookUpTable) {
  42.         delete lookUpTable;
  43.     }
  44.         delete name;
  45.         delete [] glyphs;
  46. }
  47.  
  48. void
  49. SwfFont::setFontFlags(FontFlags f)
  50. {
  51.     flags = f;
  52. }
  53.  
  54. char *
  55. SwfFont::getName()
  56. {
  57.     return name;
  58. }
  59.  
  60. FontFlags
  61. SwfFont::getFlags()
  62. {
  63.     return flags;
  64. }
  65.  
  66. long
  67. SwfFont::getNbGlyphs()
  68. {
  69.     return nbGlyphs;
  70. }
  71.  
  72. Shape  *
  73. SwfFont::getGlyph(long index)
  74. {
  75.     if (index >= nbGlyphs) return 0;
  76.     return &glyphs[index];
  77. }
  78.  
  79. long
  80. SwfFont::getGlyphCode(long index)
  81. {
  82.     if (lookUpTable == 0 || index >= nbGlyphs) return 0;
  83.     return lookUpTable[index];
  84. }
  85.  
  86. void
  87. SwfFont::setFontName(char *str)
  88. {
  89.     delete name;
  90.     name = new char[strlen(str)+1];
  91.     strcpy(name,str);
  92. }
  93.  
  94. void
  95. SwfFont::setFontLookUpTable(long *lut)
  96. {
  97.     lookUpTable = lut;
  98. }
  99.  
  100. void
  101. SwfFont::setFontShapeTable(Shape *shapes, long n)
  102. {
  103.     glyphs = shapes;
  104.     nbGlyphs = n;
  105. }
  106.